public class Array_reverse {

    public static void reverse(int[] arr) {
        int left=0;
        int right=arr.length-1;
        while(left<right) {
            int tmp=arr[left];
            arr[left]=arr[right];
            arr[right]=tmp;
            left++;
            right--;
        }
    }
    public static void main(String[] args) {
        int[] array={1,2,3,4,5};
        reverse(array);
        for(int i=0;i<array.length;i++) {
            System.out.println(array[i]+" ");
        }

    }
}
